﻿using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using Framework.Data.Core;
//
//Description : Interface pour l'exécution de commande sql
//Auteur : Marc-Eric Boisvert
//Date Création : 31 mars 2008
//Révisions:
//

namespace Framework.Data.DataBroker
{
    public interface IDataBroker
    {
    	IDbConnection Connection{get;}
    	bool OpenConnection();
    	long GetNextID(IDbConnection connection = null);
    	IEntityCollection<object, IBaseEntity> GetEntityList(System.Type entityType, List<string> filters, string sortOrder, IDbConnection connection = null, Int32 fetchRowCount = 250, Int32 rowsPerPage = 0, Int32 pageIndex = 0);
    	IBaseEntity GetEntity(System.Type entityType, long id, IDbConnection connection = null);
    	bool Delete(IBaseEntity entity, IDbConnection connection = null);
    	IEntityCollection<object, IBaseEntity> GetEntityList(System.Type entityType, string sql, IDbConnection connection = null, Int32 fetchRowCount = 250);
    	IEntityCollection<object, IBaseEntity> GetAttachedEntityList(System.Type entityType, IBaseEntity parentEntity, string linkSchemaName, string linkTableName, System.Collections.Generic.List<string> filters, string sortOrder, IDbConnection connection = null, Int32 fetchRowCount = 250, Int32 rowsPerPage = 0, Int32 pageIndex = 0);
    	bool Save(IBaseEntity entity, IDbTransaction transaction, IDbConnection connection = null);
    	//bool Save(IEntityCollection<object, IBaseEntity> collection, IDbTransaction transaction, IDbConnection connection = null);
    	//IDbTransaction GetNewTransaction(IDbConnection connection = null);
    	
    	int ExecuteSQL(string SQLCommandText, IDbConnection connection = null);
        IDataReader ExecuteReader(string SQLCommandText, IDbConnection connection = null, Int32 fetchRowCount = 250);
        object ExecuteScalar(string SQLCommandText, IDbConnection connection = null);

    }
}